package reflection;

import java.lang.reflect.Method;

import org.springframework.util.ReflectionUtils;

/**
 * @author 1203056
 * @version Id: RefectionUtilsDemo.java, v 0.1 2021-09-05 16:38 1203056 Exp $
 */
public class RefectionUtilsDemo {
    public static void main(String[] args) throws ClassNotFoundException {
        String className = "reflection.Student";
        Class<?> studentClazz = Thread.currentThread().getContextClassLoader().loadClass(className);
        Method sayHello = ReflectionUtils.findMethod(studentClazz, "sayHello");
        System.out.println(sayHello);
//
        Method runMethod = ReflectionUtils.findMethod(studentClazz, "run",int.class);
        System.out.println(runMethod);

//        Method run2Method = ReflectionUtils.findMethod(studentClazz, "run",Integer.class);
//        System.out.println(run2Method);

        Method printMethod = ReflectionUtils.findMethod(studentClazz, "print");
        System.out.println(printMethod);

    }
}
